#lang errortrace racket
(require rackunit)
(define ns (make-base-namespace))

(define (run-bool b)
  (((eval b ns) #t) #f))

(define-check (check-bool b expected)
  (check-equal?
    (run-bool b)
    expected))

; True
(define TRUE '(lambda (a) (lambda (b) a)))
(check-bool TRUE #t)


(define FALSE '(lambda (a) (lambda (b) b)))
(check-bool FALSE #f)


(define (OR a b) (list (list a TRUE) b))

(check-bool (OR TRUE TRUE) (or #t #t))
(check-bool (OR TRUE FALSE) (or #t #f))
(check-bool (OR FALSE FALSE) (or #f #f))
(check-bool (OR FALSE TRUE) (or #f #t))


(define (AND a b) (list (list a b) FALSE))
(define (NOT a) (list (list a FALSE) TRUE))
(define (EQ a b) (list (list a b) (NOT b)))

; Test
(check-equal?
    (run-bool
      (EQ TRUE (OR (AND FALSE TRUE) TRUE)))
      (equal? #t (or (and #f #t) #t)))